/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  config.cluster = {
    listen: {
      port: 4002,
    },
  };


  // 设置csrf

  config.security = {
    csrf: {
      // headerName: 'csrfToken',
      enable: false,
    },
  };

  config.jwt = {
    secret: '123321',
  };

  // 配置跨域
  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
  };

  // 配置七牛相关参数
  config.qiniuAK = 'cOENxQ8MTRoh2pgTRY58UjwUx51PyoMiXQAw9B0k';
  config.qiniuSK = 'Of40rBuhrXYV_GHcv-Vp2qXoQ9sag-ShnRhNAIzm';
  config.qiniuBucket = 'moyushop';
  config.qiniuUploadUrl = 'http://up-z1.qiniup.com';
  config.qiniuDownloadUrl = 'http://iovip-z1.qbox.me';


  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1628847384824_9302';

  // add your middleware config here
  config.middleware = [];

  // 密码字符串
  config.passwordSalt = 'moyushop818';

  // 开启上传file模式

  config.multipart = {
    mode: 'file',
  };


  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
    mysql: {
      client: {
        host: 'localhost',
        port: '3306',
        user: 'root',
        password: '213465',
        database: 'moyushop',
      },
    },
  };

  return {
    ...config,
    ...userConfig,
  };
};
